package com.group5.service;

import com.group5.pojo.PlatformExample;
import com.group5.pojo.Userss;
import com.group5.pojo.UserssExample;

public class LoginService {

    public UserssExample selectUserByUserNameExample(String username){
        UserssExample userssExample=new UserssExample();
        userssExample.or(userssExample.createCriteria().andUser_nameEqualTo(username));
        return userssExample;
    }

    public UserssExample selectUserByUserNameAndPasswordExample(String username,String password){
        UserssExample userssExample=new UserssExample();
        userssExample.or(userssExample.createCriteria().andUser_nameEqualTo(username).andPasswordEqualTo(password));
        return userssExample;
    }

    public PlatformExample selectPlatformByONameExample(String oname){
        PlatformExample platformExample=new PlatformExample();
        platformExample.or(platformExample.createCriteria().andOnameEqualTo(oname));
        return platformExample;
    }

     public Userss MD5UserPasswordAndSalt(Userss userss,String password){
        String salt= Md5Util.saltGenerate();
        userss.setSalt(salt);
        userss.setPassword(Md5Util.Md5Generate(password,salt));
        return userss;
    }
}
